﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Simhopp.GUI;
using Simhopp.Model;

namespace Simhopp.Presenter
{
    class PresenterManageCompetition
    {
        public InterfaceManageCompetitionView _view { get; set; }
        public InterfaceCompetitionListModel _model { get; set; }
        public Competition competition { get; set; }
        public PresenterManageCompetition(InterfaceManageCompetitionView view, InterfaceCompetitionListModel model, Competition competition)
        {
            this._view = view;
            this._model = model;
            this.competition = competition;
            this._view.EventRemoveCompetition += _view_EventRemoveCompetition;
            this._view.EventUpdateCompetition += _view_EventUpdateCompetition;
            this._view.EventUpdateInformation += _view_EventUpdateInformation;
        }

        Competition _view_EventUpdateInformation()
        {
            return competition;
        }

        //
        void _view_EventUpdateCompetition(Competition updateComp)
        {
            this._model.UpdateCompetition(updateComp, competition);
        }

        void _view_EventRemoveCompetition()
        {
            this._model.RemoveCompetition(competition);
        }
    }
}
